package com.scau.RBAC.dao.factory;

import com.scau.RBAC.util.DBConfig;

/**
 * DAO工厂生产类，负责根据配置创建具体的DAO工厂
 */
public class DaoFactoryProducer {
    public static DaoFactory getDaoFactory() {
        String dbType = DBConfig.getProperty("db.type", "mysql").toLowerCase();

        if (dbType.equals("mysql")) {
            return new MySqlDaoFactory();
        } else if (dbType.equals("postgresql")) {
            return new PostgreSqlDaoFactory();
        } else {
            throw new UnsupportedOperationException("不支持的数据库类型: " + dbType);
        }
    }
}